// Main libraries:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Xml;
using Microsoft.Ccr.Core;
using Microsoft.Dss.Core.Attributes;
using Microsoft.Dss.ServiceModel.Dssp;
using Microsoft.Dss.ServiceModel.DsspServiceBase;
using W3C.Soap;

namespace LabyRob
{
	/// <summary>
	/// Contract definitions
	/// </summary>
	public sealed class Contract
	{
		/// <summary>
		/// Main identifier
		/// </summary>
		[DataMember]
		public const string Identifier = "http://schemas.microsoft.com/robotics/2010/03/labyrob.html";
	}
	
	/// <summary>
	/// State class
	/// </summary>
	[DataContract]
	public class LabyRobState
	{
		/// <summary>
		/// Left Wheel power
		/// </summary>
		[DataMember]
		public double leftWheelPower = 0.5;
		/// <summary>
		/// Right wheel power
		/// </summary>
		[DataMember]
		public double rightWheelPower = 0.5;

		/// <summary>
		/// Driving state
		/// </summary>
		[DataMember]
		public Microsoft.Robotics.Services.Drive.Proxy.DriveDifferentialTwoWheelState _driveState;
	}
	
	/// <summary>
	/// Operations port
	/// </summary>
	[ServicePort]
	public class LabyRobOperations : PortSet<DsspDefaultLookup, DsspDefaultDrop, Get>
	{
	}
	
	/// <summary>
	/// Get action
	/// </summary>
	public class Get : Get<GetRequestType, PortSet<LabyRobState, Fault>>
	{
		/// <summary>
		/// Class constructor
		/// </summary>
		public Get()
		{
		}
		
		/// <summary>
		/// Overloaded class constructor
		/// </summary>
		/// <param name="body">Request</param>
		public Get(GetRequestType body)
			: base(body)
		{
		}
		
		/// <summary>
		/// Overloaded class constructor
		/// </summary>
		/// <param name="body">Request</param>
		/// <param name="responsePort">Response port</param>
		public Get(GetRequestType body, PortSet<LabyRobState, Fault> responsePort)
			: base(body, responsePort)
		{
		}
	}

	/// <summary>
	/// Console log enrty
	/// </summary>
	public class LogEntry
	{
		/// <summary>
		/// Log entry text
		/// </summary>
		public String subject { get; set; }
		/// <summary>
		/// Log entry type
		/// </summary>
		public XmlQualifiedName type { get; set; }
		/// <summary>
		/// Date/time when entry was logged:
		/// </summary>
		public DateTime time { get; set; }

		/// <summary>
		/// Class constructor
		/// </summary>
		/// <param name="subject">Log entry</param>
		/// <param name="type">Log entry level</param>
		/// <param name="time">Time entry was logged</param>
		public LogEntry(String subject, XmlQualifiedName type, DateTime time) {
			this.subject = subject;
			this.type = type;
			this.time = time;
		}
	}
}


